Haskell Is Not Not ML
نویسندگان
چکیده
We present a typed calculus IL (“intermediate language”) which supports the embedding of ML-like (strict, eager) and Haskell-like (non-strict, lazy) languages, without favoring either. IL’s type system includes negation (continuations), but not implication (function arrow). Within IL we find that lifted sums and products can be represented as the double negation of their unlifted counterparts. We exhibit a compilation function from IL to AM—an abstract von Neumann machine—which maps values of ordinary and doubly negated types to heap structures resembling those found in practical implementations of languages in the ML and Haskell families. Finally, we show that a small variation in the design of AM allows us to treat any ML value as a Haskell value at runtime without cost, and project a Haskell value onto an ML type with only the cost of a Haskell deepSeq. This suggests that IL and AM may be useful as a compilation and execution model for a new language which combines the best features of strict and non-strict functional programming.
منابع مشابه
Functional programming languages for verification tools: experiences with ML and Haskell
We compare Haskell with ML as programming languages for verification tools, based on our experience developing TRUTH in Haskell and the Edinburgh Concurrency Workbench (CWB) in ML. We discuss not only technical language features but also the “worlds” of the languages, for example, the availability of tools and libraries.
متن کاملA functional framework for the implementation of genetic algorithms: Comparing Haskell and Standard ML
We present our experience of developing a generic functional framework for the implementation of genetic algorithms (GAs). We have implemented two versions of the framework, one in Haskell and the other in Standard ML. This paper describes the structure of the framework, and compares the performance of the two versions using the Royal Road Problem in genetic algorithms. The Haskell version is f...
متن کاملFirst-Class Phantom Types
Classical phantom types are datatypes in which type constraints are expressed using type variables that do not appear in the datatype cases themselves. They can be used to embed typed languages into Haskell or ML. However, while such encodings guarantee that only wellformed data can be constructed, they do not permit type-safe deconstruction without additional tagging and run-time checks. We in...
متن کاملA Monadic Account of First-class Synchronous Events
These two quotations represent the key ideas behind two major research agendas. The first captures the essence of monadic I/O, which is the fundamental abstraction used to provide input/output and concurrency in the lazy, purely-functional language (Concurrent) Haskell. The second captures the essence of first-class synchronous events, which is the fundamental abstraction used to provide concur...
متن کاملCertified Web Services in Ynot
In this paper we demonstrate that it is possible to implement certified web systems in a way not much different from writing Standard ML or Haskell code, including use of imperative features like pointers, files, and socket I/O. We present a web-based course gradebook application developed with Ynot, a Coq library for certified imperative programming. We add a dialog-based I/O system to Ynot, a...
متن کامل